package com.qire.manhua.model.vo;

import android.graphics.Color;
import android.text.Spannable;
import android.text.SpannableStringBuilder;

import com.qire.common.collect.ArrayUtil;
import com.qire.manhua.view.style.RadiusBackgroundSpan;

public class ComicRankListOfVipVO {
    public int      id;           //: 10457,
    public String   book_name;    //: "狂女重生：纨绔七皇妃",
    public String   book_author;  //: "崇卓动漫",
    public String   book_unruly;  //: "https://p.qiremanhua.com/uploads/book/202001/5e18205c0f330.jpg",
    public String   short_title;  //: "今重生归来，看她如何手撕渣男恶女！",
    public int      end_state;    //: 0,
    public int      chapter_px;   //: 216,
    public int      read_cnt;     //: 417391544,
    public String[] tags;         //: ["穿越","古风","恋爱"]


    public CharSequence comicLabel() {
        SpannableStringBuilder builder = new SpannableStringBuilder();
        if(ArrayUtil.notEmpty(tags)) {
            for (String label : tags) {
                int startIndex = builder.length();
                builder.append(label + " ");
                RadiusBackgroundSpan bgSpan = new RadiusBackgroundSpan(Color.rgb(0x99, 0x99, 0x99), 6);
                builder.setSpan(bgSpan, startIndex, startIndex + label.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);
            }
        }
        return  builder;
    }

}
